<script src="https://code.jquery.com/jquery-1.11.3.js"></script>

    <div class="login_frame" style="position:relative";>
        <div class="login_gl" style="margin-top:10px;">
            <div id="msgdiv"></div>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <span class="login_wz" >登录</span>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <input id="loginid" name="loginid" type="text" placeholder="请输入您的用户名" value="hello"/>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <input id="password" name="password" type="password" placeholder="请输入您的密码" value="123456" />
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="login_btn" style="font-size:16px;">登录</button>
        </div>

        <div class="login_gl" style="margin-top:10px;">
            <button  id="test1" style="font-size:16px;">test1</button>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="test2" style="font-size:16px;">test2</button>
        </div>
        <div class="login_gl" style="margin-top:10px;">
            <button  id="nologintips" style="font-size:16px;">nologintips</button>
        </div>
    </div>
</div>
<script type="text/javascript">
	var domainUrl="http://localhost:18003";

	$.ajaxSetup({
        global: false,
        // 允许携带证书,添加之后跨域跳转页面失败
        xhrFields: {
            withCredentials: true
        },
        // // 允许跨域
        crossDomain: true,
        complete: function(XMLHttpRequest, textStatus){
            // console.log("XMLHttpRequest=",XMLHttpRequest);
            // console.log("XMLHttpRequest.json=",JSON.stringify(XMLHttpRequest));
            // console.log("textStatus=",textStatus);
        }
    });

    $("#login_btn").click(function(){
        $("#msgdiv").text("登录中...如果一直显示该字符请查看浏览器console");
	   var formdata = new FormData();
       var loginid = $.trim($("#loginid").val());
       var password = $.trim($("#password").val());
        if(loginid == ""){
            alert("请输入用户名");
            return false;
        }else if(password == ""){
            alert("请输入密码");
            return false;
        }
		formdata.append("loginid",loginid);
		formdata.append("password",password);
        //ajax去服务器端校验
        
        $.ajax({
            type:"POST",
            url:domainUrl+"/login",
            data:formdata,
			processData:false,
            contentType:false,
            dataType:'json',
            // async: false,
            success:function(msg,textStatus, request){
                console.log(request);
                console.log(sessionStorage);
               // var jsessionid= sessionStorage.getItem("JSESSIONID");
               //  console.log("jsessionid="+jsessionid);
               //   jsessionid= sessionStorage.getItem("access_token");
               //  console.log("jsessionid="+jsessionid);
                $("#msgdiv").text(JSON.stringify(msg));
				console.log(msg);
            }
        });
});

    $("#test1").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");


        $.ajax({
            type:"POST",
            url:domainUrl+"/test1",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            },
            error:function(response, ajaxOptions, thrownError){
                console.log("response=",response);
                console.log("ajaxOptions=",ajaxOptions);
                console.log("thrownError=",thrownError);
                $("#msgdiv").text(JSON.stringify(response));
            }
        });
    });

    $("#test2").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");


        $.ajax({
            type:"POST",
            url:domainUrl+"/test2",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            },
            error:function(response, ajaxOptions, thrownError){
                console.log("response=",response);
                console.log("ajaxOptions=",ajaxOptions);
                console.log("thrownError=",thrownError);
                $("#msgdiv").text(JSON.stringify(response));
            }
        });
    });

    $("#nologintips").click(function(){
        //ajax去服务器端校验
        $("#msgdiv").text("处理中...如果一直显示该字符请查看浏览器console");

        $.ajax({
            type:"POST",
            url:domainUrl+"/nologintips",
            processData:false,
            contentType:false,
            dataType:'json',
            success:function(msg){
                $("#msgdiv").text(JSON.stringify(msg));
            }
        });
    });

</script>